package com.hero.content.controller;

import com.hero.content.model.PageParams;
import com.hero.content.model.PageResult;
import com.hero.content.model.dto.QueryCourseParamsDto;
import com.hero.content.model.vo.CoureseListVO;
import com.hero.content.service.CourseBaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 课程基本信息 前端控制器
 * </p>
 *
 * @author itcast
 */
@Slf4j
@RestController
@RequestMapping("content")
public class CourseBaseController {

    // http://localhost:8601/api/content/course/list?pageNo=1&pageSize=10
    @Autowired
    private CourseBaseService courseBaseService;

    /**
     * 根据条件分页查询课程列表
     *
     * @param pageParams 分页参数
     * @param paramsDto  查询条件
     * @return 分页参数及其课程列表信息
     */
    @PostMapping("course/list")
    public PageResult<CoureseListVO> selectCourseListByPage(PageParams pageParams,
                                                            @RequestBody QueryCourseParamsDto paramsDto) {
        return courseBaseService.selectCourseListByPage(pageParams, paramsDto);
    }

}